package jmcnet.libcommun.communs.helpers
{
	import mx.controls.DateField;
	
	[Bindable]
	public class HelperDate // extends DateFormatter
	{
		public static const DEFAULT_DATE_FORMAT:String = "DD/MM/YYYY";
		public static const XML_DATE_FORMAT:String = "YYYY-MM-DD";
		private var formatString:String=DEFAULT_DATE_FORMAT;
				
		public function HelperDate(format:String=null) {
			if (format != null) {
				formatString = format;
			}
		}
		
		public function stringToDate(argument:String):Date {
			if (argument == null || argument.length <= 0) return null;
			return DateField.stringToDate(argument, formatString);
		}
		
		public function dateToString(argument:Date):String {
			if (argument == null) return "";
			return DateField.dateToString(argument, formatString);
		}
	}
}
